<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html lang="en">


<%@page import="java.util.List"%>
<%@page import="es.ats.codington.festival.domain.Event"%>
<%@page import="es.ats.codington.festival.domain.Visitor"%>

<html>

<head>

<link rel="Stylesheet" type="text/css" href="css/Stylesheet.css">

</head>

<body>

<h1></h1>

<% Visitor v=(Visitor) session.getAttribute("visitor");
boolean isAdmin= v.getIsAdmin();%>


<ul id="menu" align=center>

 <li><form id=NoBox action="vieweventsofuser.htm" method="post"><input id="NoBox" type="submit" name="MyPortal" value="My Portal" /></form></li>
 <li><form id=NoBox action="UpdateVisitorPage.htm" method="post"><input id="NoBox" type="submit" name="Update Personal Data" value="Update Personal Data" /></form></li>
 <li><form id=NoBox action="UpdatePasswordPage.htm" method="post"><input id="NoBox" type="submit" name="Change Password" value="Change Password" /></form></li>
 <% if(isAdmin==true){%>
<li><form id=NoBox action="EventRegistrationPage.htm" method="post"><input id="NoBox" type="submit" name="New Event" value="New Event" /></form></li>
<% }%>
 <li><form id=NoBox action="ShowAllEvents.htm" method="post"><input id="NoBox" type="submit" name="Events" value="Events" /></form></li>
 <li><form id=NoBox action="LogOut.htm" method="post"><input id="NoBox" type="submit" name="LogOut" value="Log Out" /></form></li>
</ul>
               
<table>
<tr height="200" align="left">
<td>
<div id="places" align="left" text-align="left">
  <p id="placetitle">Places</p>
  <ul>

  	<li><b><ins ><a >North</a></b></ins></li>
	<li>	<form  id="places" action="ShowEventsByPlace.htm" method="post">
			<input type="hidden" name="place" value="Stadium">
			<input id="places" type="submit" name="Stadium" value="Stadium" />
			</form></li>
	<li>	<form  id="places" action="ShowEventsByPlace.htm" method="post">
			<input type="hidden" name="place" value="Theater">
			<input id="places" type="submit" name="Theater" value="Theater" />
			</form></li>
	<li>	<form  id="places" action="ShowEventsByPlace.htm" method="post">
			<input type="hidden" name="place" value="Museum">
			<input id="places" type="submit" name="Museum" value="Museum" />
			</form></li>
	<li>	<form  id="places" action="ShowEventsByPlace.htm" method="post">
			<input type="hidden" name="place" value="Large Business">
			<input id="places" type="submit" name="Large Business" value="Large Business" />
			</form></li>
	<li></li>
	<li><b><ins><a>South</a></b></ins></li>
	<li >	<form  id="places" action="ShowEventsByPlace.htm" method="post">
			<input type="hidden" name="place" value="Zoo">
			<input id="places" type="submit" name="Zoo" value="Zoo" />
			</form></li>
	<li >	<form  id="places" action="ShowEventsByPlace.htm" method="post">
			<input type="hidden" name="place" value="Park">
			<input id="places" type="submit" name="Park" value="Park" />
			</form></li>
	<li >	<form  id="places" action="ShowEventsByPlace.htm" method="post">
			<input type="hidden" name="place" value="Traditional Market">
			<input id="places" type="submit" name="Traditional Market" value="Traditional Market" />
			</form></li>
	<li >	<form  id="places" action="ShowEventsByPlace.htm" method="post">
			<input type="hidden" name="place" value="Tourist Attraction">
			<input id="places" type="submit" name="Tourist Attraction" value="Tourist Attraction" />
			</form></li>
  </ul>
</div>
</td>
<td>

<div id="maindiv">

<h2>Festival Registration System</h2>

<h3>My Portal Page</h3>

<table border="2" id="events">
 
	<%
	Event event=new Event();
	List<Event> eventList = (List<Event>) request.getAttribute("eventSignUpList");
	%>
		<tr>
			<th>Event Name</th>
			<th>Description</th>
			<th>Duration (min.)</th>
			<th>Event Type</th>
			<th>Seats available</th>
			<th>Seats total</th>
			<th>Place</th>
			<th>Unregister</th>
		</tr>
				 
				<%
				for (int i=0;i<eventList.size();i++) {
				event =eventList.get(i);
				%>
					
										
		<tr>
		
			<form action="UnregisterforEvent.htm" method="post">
			<input type="hidden" name="idEvent" value=<%=event.getIdEvent()%>>
			<td><%=event.getEventName()%></td>
			<td><%=event.getDescription()%></td>
			<td><%=event.getDuration()%></td>
			<td><%=event.getEventType()%></td>
			<td><%=event.getSeatsAvailable()%></td>
			<td><%=event.getSeatsTotal()%></td>
			<td><%=event.getPlace()%></td>
			<td><input type="submit" name="Unregister" value="Unregister" /></td>
			</form>
		</tr>
		
		<%} %>
									
</table>

</div>

</td>
</tr>
</table>
<% String error = (String) session.getAttribute("error"); %>

<%if(error!=null){ %>
<script> 
alert ("<%=error%>");
</script>

<% session.setAttribute("error",null);} %>
</body>
</html>
